<template>
  <div class="page">
    <div class="layui-fluid">
      <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
          <div class="layui-card">
            <div class="layui-card-body">
              <div class="layui-form" lay-filter style="font-size:15px">

                   <!-- <div class="layui-form-item">
                  <label class="layui-form-label">角色身份</label>
                  <div class="layui-input-inline">
                    <select name="gradeSetting" lay-filter="gradeSetting" v-model="itemData.gradeSetting.id">
                      <option v-for="item in djlist" :value="item.gradeSetting.id">{{item.gradeSetting.gradeSetting}}</option>
                    </select>
                  </div>
                </div> -->

                 <div class="layui-form-item">
                  <label class="layui-form-label">角色身份</label>
                  <div class="layui-input-block" style="width: 190px;">
                    <input
                      type="text"
                      name="gradeSetting"
                      v-model="itemData.gradeSetting.name"
                      placeholder="输入缴费金额"
                      autocomplete="off"
                      class="layui-input"
                    />
                  </div>
                </div>

                <div class="layui-form-item">
                  <label class="layui-form-label">缴费金额</label>
                  <div class="layui-input-block" style="width: 190px;">
                    <input
                      type="number"
                      name="amount"
                      v-model="itemData.amount"
                      placeholder="输入缴费金额"
                      autocomplete="off"
                      class="layui-input"
                    />
                  </div>
                </div>


                <div class="layui-form-item">
                  <div class="layui-input-block">
                    <button class="layui-btn layui-btn-normal" @click="sure">确认</button>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  name: "feeset",
  data() {
    return {
        id:"",
        itemData:{
            amount:'',
            gradeSetting:{
                    id:'',
                    name:""
                }
        },
    };
  },
  mounted() {
    var _this = this;
    window.getdates = this.getdates;
  },
  methods: {
     getdates: function (data) {
      var _this = this;
        var url = "/profit/aapi/v1.9/fee-setting";
      ajaxRequest(url, "GET", "json", "", function(ret, err) {
      	    if(data.byfrom=='sq'){
      	    	_this.itemData = ret.data[1];
              _this.id = ret.data[1].id
              _this.itemData.amount = ret.data[1].amount/100
      	    }
      	    else{
              _this.itemData = ret.data[0];
              _this.id = ret.data[0].id
              _this.itemData.amount = ret.data[0].amount/100
            }
        });
      
    },
    sure: function () {
      var _this = this;
      var dates = _this.itemData;
      dates.amount = _this.itemData.amount * 100
      dates.id = _this.id;
      var url = "/profit/aapi/v1.9/fee-setting";
      ajaxRequest(url, "PUT", "json", dates, function(ret, err) {
        layer.msg("操作成功");
        setTimeout(function() {
          var index = parent.layer.getFrameIndex(window.name);
          parent.layer.close(index);
          parent.location.reload();
        }, 600);
      });
    },
    screens: function () {
      return screen();
    },
  },
  updated: function () {
    var _this = this;
    layui.use("form", function () {
      var form = layui.form;
      form.render();
    });
  },
};
</script>
<style scoped>
/*二级导航*/
</style>